
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.Content.Res;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Media;
using Android.Graphics;
using Android.Net;

namespace MWC.NetcampCheckin
{
    [Activity(Label = "NetcampRegister")]
    public class NetcampRegister : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                base.OnCreate(bundle);
                SetContentView(Resource.Layout.NetcampRegister);

                List<TextView> listBold = new List<TextView>();
                listBold.Add(FindViewById<TextView>(Resource.Id.firstParenthasesOfTitle));
                listBold.Add(FindViewById<TextView>(Resource.Id.secondParanthasesOfTitle));
                listBold.Add(FindViewById<TextView>(Resource.Id.boldTextOfSubtitle));
                listBold.Add(FindViewById<TextView>(Resource.Id.boldTextOfTitle));
                setFont("fonts/texgyreheros-regular-webfont.ttf", listBold, TypefaceStyle.Bold);


                List<TextView> listNormal = new List<TextView>();
                listNormal.Add(FindViewById<TextView>(Resource.Id.normalTextOfTitle));
                listNormal.Add(FindViewById<TextView>(Resource.Id.normalTextOfSubtitle));
                listNormal.Add(FindViewById<TextView>(Resource.Id.nextMeeting));
                listNormal.Add(FindViewById<TextView>(Resource.Id.date));
                listNormal.Add(FindViewById<TextView>(Resource.Id.info));
                setFont("fonts/texgyreheros-regular-webfont.ttf", listNormal, TypefaceStyle.Normal);


                Button confirm = FindViewById<Button>(Resource.Id.RegisterButton);

                confirm.Click += delegate
                {
                    Intent browserIntent = new Intent(Intent.ActionView, Uri.Parse("http://www.netcamp.pl/rejestracja"));
                    StartActivity(browserIntent);
                };

                Button back = FindViewById<Button>(Resource.Id.BackButton);

                back.Click += delegate
                {
                    Intent backIntent = new Intent(this, typeof(NetcampHome));
                    StartActivity(backIntent);
                };
            }
            catch (System.Exception e)
            {
                MWCApp.LogDebug(e);
                NetcampAlerts.UnknownError(this);
            }
            
        }

        private int ConvertPixelsToDp(float pixelValue)
        {
            var dp = (int)((pixelValue) / Resources.DisplayMetrics.Density);
            return dp;
        }
            // 1 - sciezka do czcionki, 2 - tablica, 3 - Typ:Bold,Italic,Normal,BoldItalic
        private void setFont(string path, List<TextView> tTV, TypefaceStyle Type)
        {
            AssetManager mgr;
            mgr = Assets;
            Typeface font = Typeface.CreateFromAsset(mgr, path);
            for (int i = 0; i < tTV.Count; i++)
            {
                tTV[i].SetTypeface(font, Type);
            }

        }

    }
}
